<?php
/**
 * <https://y.st./>
 * Copyright © 2015 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$sourcecode = \st\y\highlight_string(<<<'END'
<?php
#	Minetest C++ Source Code Node Finder
#	Copyright © 2015 Alex Yst <mailto:copyright@y.st>

#	This program is free software: you can redistribute it and/or modify
#	it under the terms of the GNU General Public License as published by
#	the Free Software Foundation, either version 3 of the License, or
#	(at your option) any later version.

#	This program is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU General Public License for more details.

#	You should have received a copy of the GNU General Public License
#	along with this program.  If not, see <http://www.gnu.org./licenses/>.
$regexp = '{->set\([0-9a-fx]+, "([^"]*)"\)|->getId\("([^"]*)"\)}';
$dir = dir('.');
while(false !== ($file = $dir->read())):
	if(!is_dir($file)):
		preg_match_all($regexp, file_get_contents($file), $array);
		foreach($array[0] as $key => $value):
			if($array[1][$key] != ''):
				$nodes[$array[1][$key]][$file] = true;
			endif;
			if($array[2][$key] != ''):
				$nodes[$array[2][$key]][$file] = true;
			endif;
		endforeach;
	endif;
endwhile;
ksort($nodes);
foreach($nodes as $node => $nodearray):
	echo '-- ', $node, "\n";
	ksort($nodearray);
	foreach($nodearray as $filename => $true):
		echo '-- -- ', $filename, "\n";
	endforeach;
endforeach;
END
, true);

$xhtml = array(
	'<{title}>' => 'Work on minetyst_game begins',
	'<{body}>' => <<<END
</p>
	It&apos;s far too easy to die and lose everything on the <a href="https://forum.minetest.net/viewtopic.php?f=10&amp;t=10539">just test</a> server.
	I died several times, losing everything I owned each time, and never once made it to the location I planned to set up my home.
	It doesn&apos;t help that hoards of monsters come out at night or that you can&apos;t save your place with the <code>/sethome</code> command.
	I&apos;ve decided to switch servers, and am now playing on the <a href="http://linuxgaming.us/">LinuxGaming.us</a> server.
	This new server both allows you to set a home warp point and is (as far as I can tell) monster-free.
	I&apos;m not sure if this is an intentional feature or a bug, but I was able to add protection to the area I am going to build my base in from the spawn area, despite my home being quite distant.
	I still haven&apos;t made it to the area yet though, as playing the game for extended periods of time overheats my laptop.
</p>
</p>
	I started work on minetyst_game, by which I mean I built a script related to the game that will not actually be a part of it.
	The Minetest engine contains a number of references to nodes that are to be defined in the Lua modules, but there is no documentation on any of them.
	Furthermore, these nodes aren&apos;t even all defined in minetest_game like they should be.
	This script searches through the source code to locate the nodes the engine calls for so I can be sure to define them.
	This isn&apos;t the first time I&apos;ve written this script, but I don&apos;t have a copy from before my recent data loss indecent.
	Normally, I write this script in Python, but this time, I mixed it up a little and used $a[PHP] instead.
	I thought it would be harder to use $a[PHP] for this particular job, but it turned out to actually be easier.
	Tomorrow, I will probably look over the output of the script and will maybe start work on mutilating minetest_game to form minetyst_game.
	I don&apos;t have a place to put code at the moment, so I&apos;ll just drop it here for now.
</p>
<code>$sourcecode</code>
</p>
	The $a[PHP] <code>highlight_string()</code> function outputs a mess.
	Tomorrow I will attempt to create a function that uses <code>highlight_string()</code> to do most of the leg work but outputs cleaner markup.
	Specifically, I&apos;ll remove the output of <code>&amp;nbsp;</code> as it is not a valid $a[XML] entity and remove the use of the <code>style</code> attribute, as it is a messy way to color text that would be much better dealt with in an actual style sheet.
</p>
</p>
	My <a href="/a/canary.txt">canary</a> still sings the tune of freedom and transparency.
</p>
END
);
